package cool.tianyou.blue.bird.common.model.contstant;

import com.alibaba.fastjson.JSON;
import cool.tianyou.blue.bird.model.NotificationMessage;
import java.util.Map;

/**
 * @author 刘天佑
 * @date 2021-09-02
 */
public enum DeviceMessageEnum {
  /**
   * 心跳消息
   */
  BEAT,
  /**
   * 下线消息
   */
  OFFLINE,

  /**
   * 锁定消息
   */
  DISABLED,

  /**
   * 请求解锁
   */
  REQUEST_UNLOCK,

  /**
   * 设备推送状态变更
   */
  PUSH_STATE_CHANGE;

  public static String genDeviceMessage(DeviceMessageEnum messageEnum, Map<String, Object> data) {
    NotificationMessage notificationMessage = new NotificationMessage();
    notificationMessage.setCode(105);
    notificationMessage.setType(messageEnum.name());
    notificationMessage.setNonEncrypted(data);
    return JSON.toJSONString(notificationMessage);
  }
}
